#include "info.h"
#include "re.h"
#include "utils.h"

void antikick_m(INFO *info) {

   RE *re;
   char match[512], *buffer[5];

   re = (RE *) malloc(sizeof(RE));

   sprintf(match,"^:([^ ]+)!([^ ]+)@[^ ]+ KICK ([^ ]+) %s :(.+)$",info->nick);
   if(matcher(match, info->reciev, re)) {

      buffer[0] = re_copy(re,1,info->reciev);
      buffer[1] = re_copy(re,3,info->reciev);
      buffer[2] = re_copy(re,4,info->reciev);

      ssock(info->fd, "JOIN %s\r\n", buffer[1]);
      ssock(info->fd, "PRIVMSG %s :%s, (%s) tah loco hein... =/\r\n", buffer[1], buffer[0], buffer[2]);

   }

}

void onebot_m(INFO *info) {

   antikick_m(info);

}
